<%@page import="com.mconnect.msurvey.model.Responder"%>
<%@page import="com.mconnect.msurvey.model.Survey"%>
<%@page import="java.util.List"%>
<%@page import="com.mconnect.msurvey.model.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="s" uri="/struts-tags"%>
     
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
	  <title>Panel Admina</title>
	  <link rel="stylesheet" href="resources/css/ap.css">
	  <link rel="stylesheet" href="js/jQuery/demos.css">
	  <link rel="stylesheet" href="js/jQuery/themes/base/jquery.ui.all.css">
	  <link rel="stylesheet" href="resources/css/detail_style.css">
	  <style>
		body { font-size: 62.5%; }
		label, input { display:block; }
		input.text { margin-bottom:12px; width:95%; padding: .4em; }
		fieldset { padding:0; border:0; margin-top:25px; }
		h1 { font-size: 1.2em; margin: .6em 0; }
		div#users-contain { width: 350px; margin: 20px 0; }
		div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
		.ui-dialog .ui-state-error { padding: .3em; }
		.validateTips { border: 1px solid transparent; padding: 0.3em; }
	</style>
	
  </head>

<body>
<div id="top">
   
    <img src="resources/images/kreska.png" class="kreska">
    <div class="header_txt">
      <p class="header_txt_1">Panel Administracyjny</p>
      <p class="header_txt_2">mSurvey</p>
    </div>
    <div class="session">
      <% User admin = (User)session.getAttribute("admin"); 
		if(admin == null){ %>
		<jsp:forward page="loginAdminForm.jsp"></jsp:forward>
	<%}%>

    </div>
    <ul id=menu>
      
    <li><s:a action="goToSearchSurvey"> Wyszukaj ankietę </s:a></li>
	<li><s:a action="goToUserRaport">Plan ankietera</s:a></li>
	<li><s:a action="goToRegisterUser">Dodaj ankiet</s:a></li>
	<li><s:a action="goToConfirmList">Potwierdziły przybycie</s:a></li>
	<li style="float: right"><a href="login.jsp?id=logoutAdmin">Wyloguj</a></li>
    </ul>
    
    <div id=kategorie>
    <% 	List<Survey> list = (List<Survey>)request.getAttribute("surveyList");
    	if(!list.isEmpty()){ 
    	%>
	    <div id="users-contain" class="ui-widget">
				<table id="users" class="ui-widget ui-widget-content" style="width: 700px; margin-left: 200px;">
				<thead>
				<tr class="ui-widget-header ">
					<th>Imie</th>
					<th>Nazwisko</th>
					<th>Telefon</th>
					<th>Szczegóły</th>
				</tr>
				<tbody>
					<s:iterator value="surveyList" begin="0" end="10">
						<tr>
							<td ><s:property value="id_responder.firstname"/>
							<td><s:property value="id_responder.lastname"/></td>
							<td ><s:property value="id_responder.phone"/></td>
							<td ><a href="surveyDetails.jsp?id=<s:property value="id_survey"/>&date=<s:property value="date_survey"/>&id_responder=<s:property value="id_responder.id_responder"/>">szczegóły</a></td>
						</tr>	
					</s:iterator>
				</tbody>	
				</table>
		</div>
		<%}else{ %>
		<div class="ui-widget" style="width: 80%; margin-left: 10%;">
					<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
						<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
						<strong>Nie znaleziono osób spełniających twoje kryteria.</strong> <br /><br /> Zmień kryteria wyszukiawń</p>
					</div>
					
		</div>
		
		<%} %>
		 <center>
			<div style="width:100%; float: left;">
				<div class="d_aBackSearch" style=" margin-bottom: 10px; margin-left: 35%; width: 250px;"  >
					<div class="a"><a href="javascript:history.back()" style="text-decoration: none; display: block; text-align: center; color: white; font-weight: bold;">Zmień kryteria wyszukiwania</a></div>
				</div>
			</div>
		</center>
    </div>
   	
</div>
  </body>
